home *** CD-ROM | disk | FTP | other *** search
/ Openstep 4.2 (Developer) / Openstep Developer 4.2.iso / NextDeveloper / Source / GNU / uucp / Uucp.framework / unix.subproj / priv.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-10-09  |  640 b   |  25 lines

  1. /* priv.c
  2.    See if a user is privileged.  */
  3.  
  4. #include "uucp.h"
  5.  
  6. #include "sysdep.h"
  7. #include "system.h"
  8.  
  9. /* See whether the user is privileged (for example, only privileged
  10.    users are permitted to kill arbitrary jobs with uustat).  This is
  11.    true only for root and uucp.  We check for uucp by seeing if the
  12.    real user ID and the effective user ID are the same; this works
  13.    because we should be suid to uucp, so our effective user ID will
  14.    always be uucp while our real user ID will be whoever ran the
  15.    program.  */
  16.  
  17. boolean
  18. fsysdep_privileged ()
  19. {
  20.   uid_t iuid;
  21.  
  22.   iuid = getuid ();
  23.   return iuid == 0 || iuid == geteuid ();
  24. }
  25.